package backend.project.gym_management.service.impl;

import backend.project.gym_management.mapper.EnrollmentMapper;
import backend.project.gym_management.pojo.dto.EnrollmentDTO;
import backend.project.gym_management.service.EnrollmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EnrollmentServiceImpl implements EnrollmentService {

    @Autowired
    private EnrollmentMapper enrollmentMapper;

    @Override
    public void enrollCourse(Long cid, Long uid) {
        enrollmentMapper.insertEnrollment(cid, uid);
    }

    @Override
    public List<EnrollmentDTO> getEnrollments(Long uid) {
        return enrollmentMapper.getEnrollmentsByUid(uid);
    }
}
